type OptionsProps = {
    url: string;
    filename: string;
};

export default function () {
    return function (options: OptionsProps) {
        const { url, filename } = options;
        if (!url || !filename)
            throw new Error(
                "download file must need to be url and filename..."
            );

        const a = document.createElement("a");
        a.href = options.url;
        a.download = options.filename;
        a.click();
        a.remove();
    };
}
